package com.ruoyi.system.controller;

import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.SysOrderEvaluate;
import com.ruoyi.system.service.ISysOrderEvaluateService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.UUID;

/**
 * 订单评价Controller
 * 
 * @author ruoyi
 * @date 2024-04-11
 */

@Api(tags = "用户订单评价管理")
@RestController
@RequestMapping("/mem/evaluate")
public class MemOrderEvaluateController extends BaseController
{
    @Autowired
    private ISysOrderEvaluateService sysOrderEvaluateService;

    /**
     * 查询订单评价列表
     */
    @RequiresPermissions("system:evaluate:list")
    @GetMapping("/list")
    public TableDataInfo list(SysOrderEvaluate sysOrderEvaluate)
    {
        startPage();
        List<SysOrderEvaluate> list = sysOrderEvaluateService.selectSysOrderEvaluateList(sysOrderEvaluate);
        return getDataTable(list);
    }


    /**
     * 新增订单评价
     */
    @RequiresPermissions("system:evaluate:add")
    @Log(title = "订单评价", businessType = BusinessType.INSERT)
    @PostMapping(value = "/add")
    public AjaxResult add(@RequestBody SysOrderEvaluate sysOrderEvaluate)
    {

        sysOrderEvaluate.setId(UUID.randomUUID().toString());
        return toAjax(sysOrderEvaluateService.insertSysOrderEvaluate(sysOrderEvaluate));
    }




}
